import java.awt.geom.Point2D.Double;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;


public abstract class Agent {

	protected double exploreChance = 0.0;
	
	abstract public void putReward(double aReward);
	abstract public Double getMove(double[][] input, Car car);

	//exploration move of niet?
	protected boolean doExploratoryMove() {
		return Math.random() > (1.0 - exploreChance);
	}

	// wijzigen van de exploration kans
	public void setExplorationChance(double aValue) {
		exploreChance = aValue;
	}

	protected double[] flatten_input(double[][] input, Car car)
	{
		double[] flat_input = new double[input.length*input[0].length+2];
		
		for(int i=0; i < input.length; i++) {
			for(int j=0; j < input[0].length; j++) {
				if (input[i][j] == 0.0) flat_input[(2+i*input[0].length)+j] = 1.0; //wall correction
				else flat_input[(2+i*input[0].length)+j] = input[i][j];
			}
		}
		
		
		flat_input[input.length*input[0].length]   = car.getSpeed()/car.getMaxSpeed();
		flat_input[input.length*input[0].length+1] = (car.getDirection() - 180) / 180;
		
		return flat_input;
	}
	public void save(String string) {
		
	}
	public void restore(String string) {
		
	}
	
	public void setLearnspeed(double lrn) {
	
	}
	
	 public void setDiscount(double discount) {
	   }
	   
	   public void setLambda(double lambda) {
	   }
		

	
}
